//
//  TopHotestListVIewModel.m
//  meiyinxiang
//
//  Created by 媒印象 on 25/11/2017.
//  Copyright © 2017 hbjApple. All rights reserved.
//

#import "TopHotestListVIewModel.h"
#import "TopHotestViewModel.h"
#import "TopHotestModel.h"
@implementation TopHotestListVIewModel
- (void)loadTopListWithResult:(finishBlock)result{
    if (self.modelArray == nil) {
        self.modelArray = [NSMutableArray array];
    }
    if (self.modelArray.count > 0) {
        [self.modelArray removeAllObjects];
    }
    [[MYXHttpManager shared] getTopHotestListWithResult:^(BOOL success, NSString *msg, NSArray *arrays) {
        
        if (success) {
            for (TopHotestModel *model in arrays) {
                TopHotestViewModel *topViewModel = [[TopHotestViewModel alloc] initWithTopHotestModel:model];
                [self.modelArray addObject:topViewModel];
            }
            result(YES);
        }else{
            result(NO);
        }
    } errorResult:^(NSError *enginerError) {
        result(NO);
    }];
}
@end
